/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.List;

import controll.Mapping;

/**
 *
 * @author phuc
 */
public class Tau implements Serializable {
    private static final long serialVersionUID = 1L;
    private Long tauID;
    private String tenTau;
    private List<Toa> toaList;
    private List<BangGia> bangGiaList;
    private Tuyen tuyenID;
    private List<GioTau> gioTauList;
    private Mapping map  = new Mapping();
    
    public Tau() {
    }

    public Tau(Long tauID) {
        this.tauID = tauID;
    }

    public Tau(Long tauID, String tenTau) {
        this.tauID = tauID;
        this.tenTau = tenTau;
    }

    public Long getTauID() {
        return tauID;
    }

    public void setTauID(Long tauID) {
        this.tauID = tauID;
    }

    public String getTenTau() {
        return tenTau;
    }

    public void setTenTau(String tenTau) {
        this.tenTau = tenTau;
    }

    public List<Toa> getToaList() {
    	map = new Mapping();
    	return map.getListToa(this);
    }

    public List<BangGia> getBangGiaList() {
    	map = new Mapping();
    	return map.getBangGiaList(this);        
    }

    public Tuyen getTuyenID() {
        return tuyenID;
    }

    public void setTuyenID(Tuyen tuyenID) {
        this.tuyenID = tuyenID;
    }

    /**
     * Get list gio tau theo tau
     * @return
     */
    public List<GioTau> getGioTauList() {
    	map = new Mapping();
    	return map.getGioTauList(this);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tauID != null ? tauID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tau)) {
            return false;
        }
        Tau other = (Tau) object;
        if ((this.tauID == null && other.tauID != null) || (this.tauID != null && !this.tauID.equals(other.tauID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Tau[ tauID=" + tauID + " ]";
    }

	public Tau getTauByTauID(long tauID) {
		return map.getTauByTauID(tauID);
	}
    
}
